package kyssion.leetcode.num151_200;

import kyssion.leetcode.num51_100.code91_解码方法;

public class code191_位1的个数 {
    public static void main(String[] args) {
        System.out.println(new code191_位1的个数().hammingWeight(0b11111111111111111111111111111101));
    }
    public int hammingWeight(int n) {
        int num = 0;
        for (int a = 0; a < 32; a++) {
            int i = n&1;
            if(i==1){
                num++;
            }
            n=n>>1;
        }
        return num;
    }
}
